import {createRouter, createWebHistory} from "vue-router";
import routes from "../navData/index.js";

const router = createRouter({
    history: createWebHistory(),
    routes
})

router.beforeEach((to, from, next) => {
    if (!localStorage.getItem('myToken') && to.name !== 'myLogin'){
        next({
            name: 'myLogin'
        })
    }else {
        next()
    }
});

export default router
